<template>
  <div class="container">
     <!-- 顶部导航栏 -->
    <van-nav-bar fixed title="黑马头条" right-text="搜索"/>
    <div>
     <!-- 中间内容区 -->
    <div class="my-wrapper" >
      <router-view></router-view>
    </div>
    </div>
    <van-tabbar route>
      <van-tabbar-item to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/question"  icon="chat-o">问答</van-tabbar-item>
      <van-tabbar-item to="/video"  icon="video-o">视频</van-tabbar-item>
      <van-tabbar-item to="/user"  icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<!-- scoped的作用：让这些样式仅仅在当前组件生效，防止组件之间相同的类名冲突 -->
<!-- 本质上是如何做到这件事情的？添加唯一的自定义属性用于属性选择器 -->
<style scoped lang='less'>
.container{
  width: 100%;
  height: 100%;
  position: relative;
  .my-wrapper{
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding-top: 46px;
    padding-bottom: 50px;
    box-sizing: border-box;
    &.noTop{
      padding-top: 0;
    }
  }
}
</style>
